<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.pojo.OUser,java.util.List"%>
<%@ page import="java.math.BigDecimal"%>

<%@ page import="java.util.Map"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd 

">
<%
	OUser user = (OUser) request.getAttribute("user");
%>

<%
	List<Map> list = (List<Map>) request.getAttribute("list");
%>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>个人信息</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="Assets/css/reset.css" />
<script type="text/javascript" src="Assets/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="Assets/js/js_z.js"></script>
<script
	src="<%=basePath%>bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="<%=basePath%>bower_components/jquery/dist/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" href="Assets/css/thems.css">
<script type="text/javascript">

	function tixian() {
		var url = "xjtixian.html";
		var t = {};
		var tiqu = document.getElementById("tiqu").value;
		var encash =<%=user.getEncash().toString()%>;
	    var bankname=document.getElementById("kaihuhang").value;
	    var bankcd=document.getElementById("zhanghao").value;
	    if(bankname==null||bankcd==null||bankname==""||bankcd==""){
	    	alert("请输入正确的银行卡和卡号");
	    	return false;
	    }
		if (tiqu > encash) {
			alert("您的余额小于你的提现金额，请确定后提交");
			return false;
		}
		
		t.tiqu = tiqu;
		t.bankname=bankname;
		t.bankcd=bankcd;
		/* alert(t.bankcd); */
		//alert(JSON.stringify(t));
			$.ajax({
			type : 'post',
			url : url,
			data : t,
			success : function(data) {
				if(data=="unpay"){
					alert("您已提交过一笔提取信息，请等待管理员确认后，再次提交新的提取明细");
				}
				else if(data=="not"){
				   alert("请在指定时间内提现");
				}else if(data=="unable"){
				   alert("您的余额小于你的提现金额，请确定后提交");
				}else{
					alert("您的提现申请提交成功，请等待管理员确认")
				}
			}
		});
	}
	function chakan1(id){
		 <%-- var list=<%=list%>
		 console.log(list); --%>
		 var s1 = id;
		 
			var info = {UserID : ""};
			info.UserID = s1;	
			//alert(s1);
			$.ajax({
				type : 'post',
				url : 'chakan1.html',
				data : info,
				success : function(list) {
					var res = JSON.parse(list);
					var html=""
					console.log(list)
					console.log(list.length)
					 for (var i in res){
						//var cd=res[i].createdate;
						
						//var dt = new Date(res[i].createdate);
						 
						//var time= dt.toLocaleDateString("yyyy-MM-dd hh:mm:ss");
						html += '<tr><td>' +res[i].createdate  + '</td><td>'
						+ res[i].amount+ '</td><td>'
						+ res[i].balance + '</td></tr>';
			          } 
			      $('#mingxi').html(html);
				}
			});
	 }
</script>
</head>
<body>
	<%
		
	%>
	<div class="h_top">
		<div class="h_top_m">
			欢迎来到商品交易大厅网 <span> 欢迎回来会员<%=user.getUserID()%> <a
				href="logout.html?">安全退出</a>
			</span>
		</div>
	</div>
	<!--顶部-->
	<!--头部-->
	<div class="header clearfix">
		<div class="logo">
			<a href="<%=basePath%>index.html"><img src="Assets/images/logo.png" alt="网" /></a>
		</div>
		<div class="tel">
			<!--img src="Assets/images/tel.png" alt="400-168-0000"-->
		</div>
	</div>
	<div class="nav_bg">
		<ul class="nav clearfix">
			<li ><a href="main.html">首页</a></li>
			<li><a href="bypt.html">商品交易</a></li>
			<li class="now"><a href="member.html">我的账户</a></li>
		</ul>
	</div>
	<div class="space_hx">&nbsp;</div>
	<div class="second clearfix">
		<div class="scd_l">
			<ul class="sidenav">

				<li ><a href="member.html">个人信息</a></li>
				<li><a href="selectwtdprice.html?goods=宝石">商品挂单</a></li>
				<li><a href="selllist.html?page=1&last=5">售出记录</a></li>
				<li><a href="buylist.html?page=1&last=5">购买记录</a></li>
				<li><a href="gr_money.html?page=1&last=5">交易明细</a></li>
				<li  class="now"><a href="tixian.html">提现明细</a></li>
				<li><a href="chongzhi.html">充值明细</a></li>
				<!-- <li><a href="tiqu.html">钱包管理</a></li> -->

			</ul>
			<div class="space_hx">&nbsp;</div>
		</div>
		<div class="scd_r">
			<div class="ucenter">
				<div class="box">
					<div class="box_h">
						<img src="Assets/images/icon10.png" alt="" /> <span class="red">个人账户</span>
					</div>
				
					<div class="box_m">
					
						<ul class="grxx">
					
							<li class="clearfix"><span class="title">会员编号*</span>
								<div class="li_r">
									<%=user.getUserID()%>
								</div>
								<div><h2>提现时间：09:00~16:00</h2></div>
								</li>
							<li class="clearfix "><span class="title">积分*</span>
								<div class="li_r lijifen">
									<%=user.getEncash().toString()%>
								</div>
								<div class="li_r">分</div></li>

							<form name="myform" action="?action=S" method="post"
								onSubmit="return CheckForm();">
								<table width="100%" border="0">
									<tr>
										<td>开户行</td>
										<td>
											<%
												String s = user.getBankName();
												String bn;
												if (s == null) {
											%> 
												<input class="form-control" type="text" name="kaihuhang"
											id="kaihuhang" placeholder="请输入开户行名称" value="" size="30" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"/>
											<%	} else {%>
												 <input class="form-control" type="text" name="kaihuhang"
											id="kaihuhang"  value="<%=s %>" size="30" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"/>
												<% 
													
												}
											%>
										</td>
									</tr>
									<tr>
										<td>银行账号</td>

										<td>
										<%
										String s1 = user.getBankCard();
												
												if (s1 == null) {
											%> 
												 <input class="form-control" type="text" name="zhanghao"
											id="zhanghao" placeholder="请输入银行卡号" value="" size="30" onkeyup="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"/>
											<%	} else {%>
												  <input class="form-control" type="text" name="zhanghao"
											id="zhanghao"  value="<%=s1%>" size="30" onkeyup="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"/>
												<% 
													
												}
											%>
											
										</td>
									</tr>
									<tr>
										<td>提现金额</td>
										<td><input class="form-control" type="text" name="tiqu"
											id="tiqu"></td>
									</tr>
									<tr>
										<td></td>
										<td><input type="button" onclick="tixian()" value="确认提现" />
										<input id="<%=user.getUserID()%>" type="button"
								          onclick="chakan1(this.id)" value="查看" /></td>
									</tr>
								</table>
							</form>
							<table class="table table-striped table-bordered td-center"
					id="data-lists">
					<thead>
						<tr>
							<th>时间</th>
							<th>提现金额</th>
							<th>余额</th>
							
						
						</tr>
					</thead>
					<tbody id="mingxi">

					</tbody>
				</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="space_hx">&nbsp;</div>
	<div class="space_hx">&nbsp;</div>
	<div class="f_nav_bg">
		<dl class="f_nav clearfix">
			<dt>
				<img src="Assets/images/tel.png" />
			</dt>
			<dd>
				<div class="tip" style="float: left; width: 200px;">
					<span style="font-size: 16px;">团队</span>
					<li>太原金属企业站</li>
					<li>太原金属商城</li>
					<li>太原金属会员网</li>
				</div>

				<div class="tip" style="float: left; width: 200px;">
					<span style="font-size: 16px;">服务帮助</span>

					<li><a href="news.html?classid=4">为什么选择我们</a></li>

					<li><a href="news.html?classid=3">网站声明</a></li>

					<li><a href="news.html?classid=2">公司公告</a></li>

					<li><a href="news.html?classid=1">行业动态</a></li>
				</div>
				<div class="tip">
					<p>交易大厅</p>
					<p>&nbsp;</p>
				</div>
			</dd>
		</dl>
		<div class="copyriht">版权解释权归太原金属所有</div>
	</div>

</body>
</html>
